package com.foreknow.demo9;

public class ExcptionDemo3 {
    public int sum(int a,int b) throws Exception{
        if (a < 0 || b < 0) {
            Exception e = new Exception();
            throw e;
        }
        return a+b;
    }

    public static void main(String[] args) {
        ExcptionDemo3 demo3 = new ExcptionDemo3();
        try {
            int a = demo3.sum(5,10);
            System.out.println(a);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
